﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Search.aspx.cs" Inherits="Maticsoft.Web.wap.Search" %>
<%@ Register Src="footer.ascx" TagName="footer" TagPrefix="uc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <!--#include file="include/head.htm"-->
    <script type="text/javascript">
        $(function () {
            $("#hidPage").val('1');
            LoadList();
        })

        function LoadList() {
            $.ajax({
                type: "get",
                url: "Search.aspx",
                data: "sync=true&page=" + $("#hidPage").val() + "&key=" + $("#hidkey").val() + "&d=" + new Date().toString(),
                success: function (msg) {
                    if (msg != "") {
                        var obj = eval('(' + msg + ')');
                        var res = "";
                        for (var i = 0; i < obj.list.length; i++) {
                            res += "<div class=\"mui-col-xs-6 mui-pull-left\">";
                            res += "<div class=\"good-mes bg-white\">";
                            res += "<div class=\"good-img\"><a href=\"ProductDetail.aspx?cid=" + $("#hidCategory").val() + "&id=" + obj.list[i].id + "\"><img src=\"/uploadpic/" + obj.list[i].pic + "\"></a></div>";
                            res += "<h5 class=\"mui-ellipsis-2 tc-black\">" + obj.list[i].name + "</h5>";
                            res += "<div class=\"mui-row\"><h4 class=\"tc-red mui-pull-left\">" + obj.list[i].price + "</h4></div>";
                            res += "</div>";
                            res += "</div>";
                        }

                        $("#list").append(res);

                        if (parseInt(obj.total) > parseInt(obj.currPage)) {
                            $("#hidPage").val(parseInt(obj.currPage) + 1);
                            $("#listMore").show();
                        }
                        else {
                            $("#listMore").hide();
                        }
                    }
                },
                error: function (msg) {

                }
            })
        }

        function LoadMore() {
            LoadList();
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:HiddenField ID="hidPage" runat="server" />
    <input id="hidkey" type="hidden" value="<%=Request.QueryString["key"] %>" />
    <header class="mui-bar">
			<a class="mui-action-back gotoup mui-pull-left"></a>
			<h1 class="mui-title" runat="server">搜索结果</h1>
            <a class="mui-pull-right tc-black" href="default.aspx"><img src="img/home.png" class="icons-car"></a>
		</header>
    <div class="mui-content pad-btm-60">
        <div class="goods-box">
            <div id="list" class="mui-row good-list pad-top-10">
            </div>
            <div id="listMore" style="width: 100%; text-align: center; line-height: 50px; background-color: #f6f4f4;
                cursor: pointer;" onclick="LoadMore();">
                加载更多</div>
        </div>
    </div>
    <uc2:footer ID="footer22" runat="server" />
    </form>
</body>
</html>
